//
//  HYHomeCell.m
//  child
//
//  Created by lijianguomac on 13-9-22.
//  Copyright (c) 2013年 lijianguomac. All rights reserved.
//

#import "HYHomeCell.h"

@implementation HYHomeCell

@synthesize delegate;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}


-(void)clickBtn1:(id)sender{
    [delegate doGrowingUpFiles:sender];
}

// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    
    int height = (rect.size.height-65)/3;
    
    int lineY1 = (height-53)/2;
    int x1 = 27;
    int x2 = 134;
    int x3 = 241;
    
    int y1 = 30+lineY1-10;
    int y2 = 30+height+lineY1-10;
    int y3 = 30+height*2+lineY1-10;
    
    int yl1 = 30+lineY1+53+5;
    int yl2 = 30+height+lineY1+53+5;
    int yl3 = 30+height*2+lineY1+53+5;
    
    
    // Drawing code
    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn1.frame = CGRectMake(x1, y1, 53, 53);
    [btn1 setBackgroundImage:[UIImage imageNamed:@"ico_czda.png"] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(clickBtn1:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn1];
    
    UILabel *lbl1 = [[UILabel alloc] initWithFrame:CGRectMake(x1, yl1, 53, 13)];
    lbl1.font = [UIFont systemFontOfSize:11];
    [lbl1 setTextAlignment:NSTextAlignmentCenter];
    lbl1.text = @"成长档案";
    [self addSubview:lbl1];
    [lbl1 release];
    
    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn2.frame = CGRectMake(x2, y1, 53, 53);
    [btn2 setBackgroundImage:[UIImage imageNamed:@"ico_jlzx.png"] forState:UIControlStateNormal];
    [self addSubview:btn2];
    
    UILabel *lbl2 = [[UILabel alloc] initWithFrame:CGRectMake(x2, yl1, 53, 13)];
    lbl2.font = [UIFont systemFontOfSize:11];
    [lbl2 setTextAlignment:NSTextAlignmentCenter];
    lbl2.text = @"交流中心";
    [self addSubview:lbl2];
    [lbl2 release];
    
    UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn3.frame = CGRectMake(x3, y1, 53, 53);
    [btn3 setBackgroundImage:[UIImage imageNamed:@"ico_jrsx.png"] forState:UIControlStateNormal];
    [self addSubview:btn3];
    
    UILabel *lbl3 = [[UILabel alloc] initWithFrame:CGRectMake(x3, yl1, 53, 13)];
    lbl3.font = [UIFont systemFontOfSize:11];
    [lbl3 setTextAlignment:NSTextAlignmentCenter];
    lbl3.text = @"今日所学";
    [self addSubview:lbl3];
    [lbl3 release];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(10, 30+height, rect.size.width-20, 1)];
    line1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"line_tran"]];
    [self addSubview:line1];
    [line1 release];
    
    
    UIButton *btn4 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn4.frame = CGRectMake(x1, y2, 53, 53);
    [btn4 setBackgroundImage:[UIImage imageNamed:@"ico_zybx.png"] forState:UIControlStateNormal];
    [self addSubview:btn4];
    
    UILabel *lbl4 = [[UILabel alloc] initWithFrame:CGRectMake(x1, yl2, 53, 13)];
    lbl4.font = [UIFont systemFontOfSize:11];
    [lbl4 setTextAlignment:NSTextAlignmentCenter];
    lbl4.text = @"在园表现";
    [self addSubview:lbl4];
    [lbl4 release];
    
    UIButton *btn5 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn5.frame = CGRectMake(x2, y2, 53, 53);
    [btn5 setBackgroundImage:[UIImage imageNamed:@"ico_jzzt.png"] forState:UIControlStateNormal];
    [self addSubview:btn5];
    
    UILabel *lbl5 = [[UILabel alloc] initWithFrame:CGRectMake(x2, yl2, 53, 13)];
    lbl5.font = [UIFont systemFontOfSize:11];
    [lbl5 setTextAlignment:NSTextAlignmentCenter];
    lbl5.text = @"家长嘱托";
    [self addSubview:lbl5];
    [lbl5 release];
    
    UIButton *btn6 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn6.frame = CGRectMake(x3, y2, 53, 53);
    [btn6 setBackgroundImage:[UIImage imageNamed:@"ico_mrsp.png"] forState:UIControlStateNormal];
    [self addSubview:btn6];
    
    UILabel *lbl6 = [[UILabel alloc] initWithFrame:CGRectMake(x3, yl2, 53, 13)];
    lbl6.font = [UIFont systemFontOfSize:11];
    [lbl6 setTextAlignment:NSTextAlignmentCenter];
    lbl6.text = @"每日食谱";
    [self addSubview:lbl6];
    [lbl6 release];
    
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(10, 30+height*2, rect.size.width-20, 1)];
    line2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"line_tran"]];
    [self addSubview:line2];
    [line2 release];
    
    
    UIButton *btn7 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn7.frame = CGRectMake(x1, y3, 53, 53);
    [btn7 setBackgroundImage:[UIImage imageNamed:@"jzjy.png"] forState:UIControlStateNormal];
    [self addSubview:btn7];
    
    UILabel *lbl7 = [[UILabel alloc] initWithFrame:CGRectMake(x1, yl3, 53, 13)];
    lbl7.font = [UIFont systemFontOfSize:11];
    [lbl7 setTextAlignment:NSTextAlignmentCenter];
    lbl7.text = @"家长建议";
    [self addSubview:lbl7];
    [lbl7 release];
    
    UIButton *btn8 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn8.frame = CGRectMake(x2, y3, 53, 53);
    [btn8 setBackgroundImage:[UIImage imageNamed:@"ico_xygg.png"] forState:UIControlStateNormal];
    [self addSubview:btn8];
    
    UILabel *lbl8 = [[UILabel alloc] initWithFrame:CGRectMake(x2, yl3, 53, 13)];
    lbl8.font = [UIFont systemFontOfSize:11];
    [lbl8 setTextAlignment:NSTextAlignmentCenter];
    lbl8.text = @"校园公告";
    [self addSubview:lbl8];
    [lbl8 release];
    
    UIButton *btn9 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn9.frame = CGRectMake(x3, y3, 53, 53);
    [btn9 setBackgroundImage:[UIImage imageNamed:@"ico_sz.png"] forState:UIControlStateNormal];
    [self addSubview:btn9];
    
    UILabel *lbl9 = [[UILabel alloc] initWithFrame:CGRectMake(x3, yl3, 53, 13)];
    lbl9.font = [UIFont systemFontOfSize:11];
    [lbl9 setTextAlignment:NSTextAlignmentCenter];
    lbl9.text = @"设置";
    [self addSubview:lbl9];
    [lbl9 release];
    
    
    UIView *line3 = [[UIView alloc] initWithFrame:CGRectMake(106, 30, 1, rect.size.height-65)];
    line3.backgroundColor = [UIColor darkTextColor];
    [self addSubview:line3];
    [line3 release];
    
    UIView *line4 = [[UIView alloc] initWithFrame:CGRectMake(212, 30, 1, rect.size.height-65)];
    line4.backgroundColor = [UIColor darkTextColor];
    [self addSubview:line4];
    [line4 release];
}


@end
